package top.yuzt.animalserver.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import top.yuzt.animalserver.entity.Animal;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import top.yuzt.animalserver.entity.User;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author yuzt
 * @since 2024-05-16
 */
@Mapper
public interface AnimalMapper extends BaseMapper<Animal> {
    @Select("SELECT * FROM animal WHERE keeper_id = #{userid} AND end_time IS NULL")
    List<Animal> findByUseridisNull(Integer userid);

    @Select("SELECT * FROM animal WHERE end_time IS NULL")
    List<Animal> ListisNull();

    @Select("SELECT * FROM animal WHERE keeper_id = #{userid}")
    List<Animal> findByUserid(Integer userid);

    @Select("SELECT * FROM animal WHERE health_status = #{status}")
    List<Animal> findByHealth(String status);
}
